﻿@using Layui.Entities
@model SysUser
     
    <div class="col-sm-12">
        <div class="space-10"></div>
        <form asp-route="editUser" id="formEditUser" method="post" onsubmit="return false;" class="form-horizontal">
            @Html.HiddenFor(m => m.Id)
            @if (Model == null || Model.Id == Guid.Empty)
            {
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">@Html.RequiredSpan()账号</label>
                    <div class="col-sm-5">
                        <input type="text" class="form-control" asp-for="Account" placeholder="用户账号" />
                    </div>
                    <span class="inline text-danger" asp-validation-for="Account"></span>
                </div>
            }
            else
            {
                <div class="form-group">
                    <label class="col-sm-3 control-label no-padding-right">@Html.RequiredSpan()账号</label>
                    <div class="col-sm-9">
                        @Html.HiddenFor(m => m.Account)
                        <b>@Model.Account</b>
                    </div>
                </div>
            }
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right">@Html.RequiredSpan()姓名</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" asp-for="Name" placeholder="真实姓名" />
                </div>
                <span class="inline text-danger" asp-validation-for="Name"></span>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right">手机号码</label>
                <div class="col-sm-3">
                    <input type="text" asp-for="MobilePhone" class="form-control" placeholder="手机号码" />
                </div>
                <span asp-validation-for="MobilePhone" class="inline text-danger "></span>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right">邮箱地址</label>
                <div class="col-sm-6">
                    <input type="text" asp-for="Email" class="form-control" placeholder="邮箱地址" />
                </div>
                <span asp-validation-for="Email" class="inline text-danger "></span>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label no-padding-right">性别</label>
                <div class="radio">
                    <label>
                        @Html.RadioButtonFor(m => m.Sex, "男", new { @class = "ace", id = "sex1" })
                        <span class="lbl"> 男</span>
                    </label>
                    <label>
                        @Html.RadioButtonFor(m => m.Sex, "女", new { @class = "ace", id = "sex2" })
                        <span class="lbl"> 女</span>
                    </label>
                </div>
            </div>
            <div class="col-md-offset-3">
                <button class="btn btn-info btn-sm" type="submit">
                    <i class="ace-icon fa fa-check bigger-110"></i>
                    提交
                </button>
            </div>
        </form>
    </div> 
<script>
    $(function () {
        $.validator.unobtrusive.parse($('#formEditUser'));
        $('#formEditUser').submit(function (e) {
            if ($(this).valid()) {
                layer.load(2);
                $(this).ajaxSubmit(function (data) {
                    if (data.Status) { 
                        location.reload();
                    } else {
                        layer.msg(data.Message, { icon: 2 });
                    }
                });
            }
        });
    });
</script>